﻿#pragma once

#include <afxbutton.h>

#define CS_NONE 0
#define CS_FLAG 1
#define CS_BOMB 2
#define CS_OVER 3

class CBlock : public CMFCButton
{
public:
	CBlock(CWnd* pParent,const LONG & CX,const LONG & CY, const int & ID,const LONG & X,const LONG & Y, bool IsMine = false, bool WasOpened = false, bool WasChecked = false, int CareState = CS_NONE );

	~CBlock();
	
protected:
	CBlock();
	CWnd*	m_hParent;
	UINT	m_uId;
	bool	m_bVisable;
	bool	m_bIsOpened;
	bool	m_bIsMine;
	int		m_iCareState;
	bool	m_bLRClicked;
	bool	m_bLPress;
	bool	m_bRPress;

public:

	const bool& IsMine()const{return m_bIsMine;}
	const bool& IsOpened()const{return m_bIsOpened;}
	const bool& IsVisable()const{return m_bVisable;}

	void MakeOpened(){m_bIsOpened = true;}
	void MakeMine(){m_bIsMine = true;}
	void MakeCareState( int state ){m_iCareState = state;}
	void MakeRPressFalse(){m_bRPress = false;}
	void MakeLPressFalse(){m_bLPress = false;}
	void MakePosition( CPoint* LPPos , CSize* LPSize );		//改变按钮大小、位置
	void MakeVisable( bool visable );						//显示、隐藏

	const int& GetCareState()const{return m_iCareState;}
	const UINT& GetThisBlockId()const{return m_uId;}
	
	void MakeInitialization();

	DECLARE_MESSAGE_MAP()
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
};
